package xyz.weblade.lynchmybatis.utils.excel;

import java.util.ArrayList;
import java.util.List;

class CompanyVO {
    private String companyId;
    private String companyName;
    @MultiExcelNode
    private List<OrdersVO> orders;

    // Getters and Setters
    public String getCompanyId() { return companyId; }
    public void setCompanyId(String companyId) { this.companyId = companyId; }

    public String getCompanyName() { return companyName; }
    public void setCompanyName(String companyName) { this.companyName = companyName; }

    public List<OrdersVO> getOrders() { return orders; }
    public void setOrders(List<OrdersVO> orders) { this.orders = orders; }

    @Override
    public String toString() {
        return "CompanyVO{" +
                "companyId='" + companyId + '\'' +
                ", companyName='" + companyName + '\'' +
                ", orders=" + orders +
                '}';
    }
}

class OrdersVO {
    private String orderId;
    private String orderSize;
    private String orderNumbers;
    @MultiExcelNode
    private List<DetailsVO> details;

    // Getters and Setters
    public String getOrderId() { return orderId; }
    public void setOrderId(String orderId) { this.orderId = orderId; }

    public String getOrderSize() { return orderSize; }
    public void setOrderSize(String orderSize) { this.orderSize = orderSize; }

    public String getOrderNumbers() { return orderNumbers; }
    public void setOrderNumbers(String orderNumbers) { this.orderNumbers = orderNumbers; }

    public List<DetailsVO> getDetails() { return details; }
    public void setDetails(List<DetailsVO> details) { this.details = details; }

    @Override
    public String toString() {
        return "OrdersVO{" +
                "orderId='" + orderId + '\'' +
                ", orderSize='" + orderSize + '\'' +
                ", orderNumbers='" + orderNumbers + '\'' +
                ", details=" + details +
                '}';
    }
}

class DetailsVO {
    private String detailId;
    private String detailName;
    private String detailNo;

    // Getters and Setters
    public String getDetailId() { return detailId; }
    public void setDetailId(String detailId) { this.detailId = detailId; }

    public String getDetailName() { return detailName; }
    public void setDetailName(String detailName) { this.detailName = detailName; }

    public String getDetailNo() { return detailNo; }
    public void setDetailNo(String detailNo) { this.detailNo = detailNo; }

    @Override
    public String toString() {
        return "DetailsVO{" +
                "detailId='" + detailId + '\'' +
                ", detailName='" + detailName + '\'' +
                ", detailNo='" + detailNo + '\'' +
                '}';
    }
}

public class Main02 {
    public static void main(String[] args) {
        // 构造明细数据
        xyz.weblade.lynchmybatis.utils.excel.DetailsVO detail1 = new xyz.weblade.lynchmybatis.utils.excel.DetailsVO();
        detail1.setDetailId("D001");
        detail1.setDetailName("iPhone 15");
        detail1.setDetailNo("IP15-256GB");

        xyz.weblade.lynchmybatis.utils.excel.DetailsVO detail2 = new xyz.weblade.lynchmybatis.utils.excel.DetailsVO();
        detail2.setDetailId("D002");
        detail2.setDetailName("MacBook Pro");
        detail2.setDetailNo("MBP-16GB");

        xyz.weblade.lynchmybatis.utils.excel.DetailsVO detail3 = new xyz.weblade.lynchmybatis.utils.excel.DetailsVO();
        detail3.setDetailId("D003");
        detail3.setDetailName("iPad Pro");
        detail3.setDetailNo("IPAD-128GB");

        // 构造订单数据
        xyz.weblade.lynchmybatis.utils.excel.OrdersVO order1 = new xyz.weblade.lynchmybatis.utils.excel.OrdersVO();
        order1.setOrderId("O001");
        order1.setOrderSize("Large");
        order1.setOrderNumbers("ON1001");
        order1.setDetails(new ArrayList<>(List.of(detail1, detail2)));

        xyz.weblade.lynchmybatis.utils.excel.OrdersVO order2 = new xyz.weblade.lynchmybatis.utils.excel.OrdersVO();
        order2.setOrderId("O002");
        order2.setOrderSize("Medium");
        order2.setOrderNumbers("ON1002");
        order2.setDetails(new ArrayList<>(List.of(detail3)));

        // 构造公司数据
        xyz.weblade.lynchmybatis.utils.excel.CompanyVO company = new xyz.weblade.lynchmybatis.utils.excel.CompanyVO();
        company.setCompanyId("C1001");
        company.setCompanyName("Apple Inc.");
        company.setOrders(new ArrayList<>(List.of(order1, order2)));

        // 构建公司列表
        List<xyz.weblade.lynchmybatis.utils.excel.CompanyVO> companyList = new ArrayList<>();
        companyList.add(company);
        // 示例数据
        // 这里可以根据实际情况创建数据并调用 buildTreeNode 方法构建树节点
        MultiLevelExcelUtil<CompanyVO> companyVOMultiLevelExcelUtil = new MultiLevelExcelUtil<CompanyVO>(CompanyVO.class);
        companyVOMultiLevelExcelUtil.exportExcel(companyList,"test.xlsx","test");

    }
}